<!-- form不能嵌套，因此不能放到widget_scenicspot.tpl中 -->
<div class="hidden" id="set-scenic-attr">
    <form action="" method="POST" name="formAttr" onSubmit="return form_scenic_attr(this)">
       <div class="stitle"></div>
       <div class="stype" style="display:none;"></div>
       <div class="sid" style="display:none;"></div>
        <div class="hang fix">
                <span class="span">开始时间</span>
               <!-- <input type="text" name="startTime" placeholder="08:00" class="input">-->
                <select name="startTime" class="input" id="">
                    <{section name=loop loop=24}>
                    <option  value="<{if $smarty.section.loop.index < 10}>0<{$smarty.section.loop.index}>:00<{else}><{$smarty.section.loop.index}>:00<{/if}>">
                        <{if $smarty.section.loop.index < 10}>
                                        0<{$smarty.section.loop.index}>:00
                        <{else}>
                        <{$smarty.section.loop.index}>:00
                        <{/if}>
                    </option>
                    <{/section}>
                </select>
                <span class="span">结束时间</span>
                <select name="stopTime" class="input" id="">
                    <{section name=loop loop=24}>
                    <option  value="<{if $smarty.section.loop.index < 10}>0<{$smarty.section.loop.index}>:00<{else}><{$smarty.section.loop.index}>:00<{/if}>">
                        <{if $smarty.section.loop.index < 10}>
                        0<{$smarty.section.loop.index}>:00
                        <{else}>
                        <{$smarty.section.loop.index}>:00
                        <{/if}>
                    </option>
                    <{/section}>
                </select>
               <!-- <input type="text" name="stopTime" placeholder="12:00" class="input">-->
        </div>

        <label  class="hang fix">
            <span class="span">说点什么<br><em style="color: #ee6a6c">(必填)</em></span>
            <textarea name="desc" placeholder="在这个景点你要玩些什么？控制在0-50字" class="textarea" maxlength="50"></textarea>
        </label>

        <div class="bottom fix">
            <span class="cancel" onclick="scenic_cancel()">取消</span>
            <input type="submit" name="sbt" value="确定" class="ok" onclick="return submit_scenic_attr();">
        </div>
    </form>
</div>
<form name="formDays" class="days" action="" method="POST" enctype="multipart/form-data">

    <img src="/resource/www/imgs/lux_2.png" class="jind-img">

    <div class="li fix">
        <span class="text">路线名称</span>
        <input type="text" class="route-name" name="name" value="<{$track.name}>" placeholder="可设计一个有趣的名字，不过超20个字" maxlength="20">
    </div>
    <div class="li fix">
        <span class="text">路线描述</span>
        <textarea class="lux-miaos" name="summary" placeholder="请描述这一天你会与游客如何度过，请尽量写的详细，旅行本来很感性，路线描述得到位可以为线路增色不少~"><{$track.summary}></textarea>

    </div>
    <div class="li fix">
        <span class="text jingd">景点横幅图</span>
        <div class="upload banner" id="upload-hf" style="background-size: cover;<{if $track.bannerUrl}>background-image:url(<{$track.bannerUrl}>);<{/if}> ">
            <input type="file" name="bannerUrl">
        </div>
        <div class="upload-notice">
         <div class="notice-text">
景点横幅图会全屏展示在路线的最上方，为了更好的显示效果，哇吖建议您:<br>1.选择1M左右的清晰大图<br>2.图片格式尽量选择png等矢量图。<br>哇吖会对图片进行处理，此处的浏览不代表最后的显示结果。         
        </div>
        </div>    
     </div>


    <div class="li fix">
        <span class="text jingd">景点缩略图</span>
        <div class="upload thumb" id="upload-sl" style="background-size: cover;<{if $track.thumb}>background-image:url(<{$track.thumb}>);<{/if}> ">
            <input type="file" name="thumb">
        </div>
        <div class="upload-notice">
        <div class="notice-text">
景点缩略图会展示在搜索页的左方，为了更好的显示效果，哇吖建议您:<br>1.选择1M以内的中尺寸清晰图片<br>2.图片格式尽量选择png等矢量图。<br>3.图片长宽比尽量贴近5:4<br>哇吖会对图片进行处理，此处的浏览不代表最后的显示结果。       
       </div>
       </div>
    </div>

    <{include file="www/track/widget_scenicspot.tpl"}>

    <div class="click-btn fix">
        <a href="/track/create_basic/<{$track.id}>" class="go-back">上一步</a>
        <input type="button" name="submit1" class="submit" value="下一步" onClick="return submit_track_days(this);">
    </div>


</form>

<script>

function event_upload_change (event) {
    var file = $(event.target)[0].files[0];
    if(file){
    	var src = URL.createObjectURL(file);
        $(event.target).parent().css("background-image","url("+src+")");
    }   
    return;
}

function submit_track_days(btnItem) {

    var oName = $('.days').find("input[name='name']").val();
    if (!$.trim(oName)) {
        layer.msg('请输入路线名称');
        return false;
    }

    var oSummary = $('.days').find("textarea[name='summary']").val();
    if (!$.trim(oSummary)) {
        layer.msg('请输入路线描述');
        return false;
    }

    if ($('input:file[name="bannerUrl"]').parent().css('backgroundImage').indexOf('up_img_icon') > -1 ) {
        layer.msg('请选择景点横幅图');
        return false;
    }

    if ($('input:file[name="thumb"]').parent().css('backgroundImage').indexOf('up_img_icon') > -1 ) {
        layer.msg('请选择景点缩略图');
        return false;
    }

    var ocul = 1;
    $('.day').find('li').each(function() {
        if ($(this).hasClass('scenic')) {
            ocul = 0;
        }
    });

    if (ocul) {
        layer.msg('请至少填写一项行程');
        return false;
    }

    $(btnItem).attr('disabled', 'disabled');
    layer.msg("<strong>资料上传中，请等待 ...</strong>", {shade: [0.7, '#1a1a1a'] , time: 600000 });

    // safari 模式下有问题，作废
    
    //var index = layer.load(2, {
    //    shade: [0.7,'#1a1a1a'] //0.1透明度的白色背景
   // });
    window.setTimeout(function () {
        $('form[name=formDays]').submit();
    }, 200);

    return false;
}
</script>

<script>
    $("input[name=thumb]").change(event_upload_change);
    $("input[name=bannerUrl]").change(event_upload_change);

    $("#upload-hf").mouseover(function(){
    	$(this).parent().find("div.upload-notice").fadeIn();
    });
    $("#upload-hf").mouseout(function(){
    	$(this).parent().find("div.upload-notice").fadeOut();
    });
    $("#upload-sl").mouseover(function(){
    	$(this).parent().find("div.upload-notice").fadeIn();
    });
    $("#upload-sl").mouseout(function(){
    	$(this).parent().find("div.upload-notice").fadeOut();
    });
</script>



